<!--头部-->
<div class="layui-fluid">
	<div class="top_header">
		<div class="layui-container">
			<!--导航-->
			<nav class="navbar navbar-default" role="navigation" style="margin: 0;">
				<div class="container-fluid">
					<div class="navbar-header">
						<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#example-navbar-collapse">
							<span class="sr-only">微乐优</span>
							<span class="icon-bar"></span>
							<span class="icon-bar"></span>
							<span class="icon-bar"></span>
						</button>
						<a class="navbar-brand" href="../dynamic/news.html">
							<img src="../../img/logo.png" alt="" class="logo_img">
						</a>
					</div>
					<div class="collapse navbar-collapse" id="example-navbar-collapse">
						<ul class="nav navbar-nav">
							<li class="active">
								<a href="../dynamic/news.html">高考动态</a>
							</li>
							<li class="nav-phone">
								<a href="../enrollment_programs/entrance_marks.html">招生计划</a>
								<div class="sub_nav_01">
									<ul>
										<li>
											<a href="../enrollment_programs/entrance_inquire.html">2019年高校招生计划</a>
										</li>
										<li class="">
											<a href="../enrollment_programs/entrance_marks.html">2019年高考分数线</a>
										</li>
										<li>
											<a href="../enrollment_programs/ranking_specialty.html">2019年贫困专项计划</a>
										</li>
										<li>
											<a href="../enrollment_programs/university_VR.html">高校VR全景视图</a>
										</li>
										<li>
											<a href="../enrollment_programs/ranking_school.html">高校人气排行榜</a>
										</li>
										<li>
											<a href="../enrollment_programs/special_item.html">专业人气排行榜</a>
										</li>
										<li>
											<a href="../enrollment_programs/build_uni.html">”双一流“建设高校</a>
										</li>
										<li>
											<a href="../enrollment_programs/apply_number.html">历年高考人数</a>
										</li>
									</ul>
								</div>
							</li>
							<li class="nav-phone">
								<a href="../enrollment_programs/entrance_inquire.html">录取分数</a>
								<div class="sub_nav_01">
									<ul>
										<li class="">
											<a href="../enrollment_score/score_wire.html">高校(专业)历年分数线</a>
										</li>
										<li class="">
											<a href="../enrollment_score/specify.html">指定高校(专业)分数线</a>
										</li>
										<li class="">
											<a href="../enrollment_score/choose.html">知分筛选学校</a>
										</li>
										<li class="">
											<a href="../enrollment_score/contrast.html">学校(专业)对比 </a>
										</li>
										<li class="active">
											<a href="../enrollment_score/record.html">对比记录</a>
										</li>

									</ul>
								</div>
							</li>
							<li class="nav-phone nav-phone-commont">
								<a>评论专区</a>
								<div class="sub_nav_01">
									<ul>
										<li class="active" data-idx="1">
											高等院校讨论区
										</li>
										<li data-idx="2">
											自主招生讨论区
										</li>
										<li data-idx="3">
											艺术招生讨论区
										</li>
										<li data-idx="4">
											体育招生讨论区
										</li>
										<li data-idx="5">
											保送招生讨论区
										</li>
										<li data-idx="6">
											专项计划讨论区
										</li>
									</ul>
								</div>
							</li>
							<li class="nav-phone nav-phone-commont">
								<a>个人中心</a>
								<div class="sub_nav_01">
									<ul>
										<li class="">
											<a href="../personal_center/profile.html">我的资料</a>
										</li>
										<li>
											<a href="../personal_center/my_favorite.html">我的收藏</a>
										</li>
										<li>
											<a href="../personal_center/about_us.html">关于我们</a>
										</li>
										<li>
											<a href="../personal_center/feedback.html">意见反馈</a>
										</li>
									</ul>
								</div>
							</li>
							<li class="nav-phone message_li">
								<a href="javascript:void(0);" class="no_read">
									<img src="../../img/no_read.png" />
								</a>
								<div class="sub_nav">
									<ul>
										<li class="clearfix">
											<div class="comment_left fl"><img src="../../img/potrait.png" class="potrait_com" /></div>
											<div class="comment_right fl">
												<div class="middle_inner">
													<h4><span><strong>徐三儿</strong>赞了你的评论</span> <em class="fr">2019
															-05-17 12:23</em></h4>
													<p>新闻专业前景不好</p>
												</div>
											</div>
										</li>
										<li class="clearfix">
											<div class="comment_left fl"><img src="../../img/potrait.png" class="potrait_com" /></div>
											<div class="comment_right fl">
												<div class="middle_inner">
													<h4><span><strong>徐三儿</strong>赞了你的评论</span><em class="fr">2019
															-05-17 12:23</em></h4>
												</div>
											</div>
										</li>
										<div class="delete_message" id="delete_message">
											<img src="../../img/temp/delete_icon.png" class="delete_icon" />删除消息列表
										</div>
									</ul>
								</div>
							</li>
							<li class="nav-phone nav-phone-lr" style="padding: 0;">
								<a href="../personal_center/profile.html">
									<img src="../../img/potrait.png" id="user_potrait" />
									<span id="nickName" class=""></span>
								</a>
								<a href="javascript:void(0);" id="loginout">退出登录</a>
							</li>
						</ul>
					</div>
				</div>
			</nav>
		</div>
	</div>
	<script type="text/javascript" src="../../js/jquery-1.11.0.min.js"></script>
	<script type="text/javascript" src="../../js/cookieUtils.js"></script>
	<script>
		var userId = GetCookie("userId");

		$.ajax({
			type: "get",
			url: "http://47.111.188.27:8080/gsgkzyl/mine/center/" + userId,
			success: function(p) {
				console.log(p)
				var data = p.data;
				if(data.head_photo != null && data.head_photo != undefined && data.head_photo != "") {
					$('#user_potrait').attr('src', data.head_photo);
				} else {
					$('#user_potrait').attr('src', '../../img/potrait.png');
				}
				$('#nickName').html(data.nick);
			}
		});
		
		/*后台消息。*/
		/*$.ajax({
			type:"get",
			url:"http://47.111.188.27:8080/gsgkzyl/discussbar/messages/21a5120c760a11e9ac560c96e6d7103a",
			success:function(){
				
			}
		});*/
		
		
		/*退出登录*/
		$('#loginout').click(function() {

			var userId = GetCookie("userId");

			$.ajax({
				type: "get",
				url: "http://47.111.188.27:8080/gsgkzyl/user/logout/" + userId,
				success: function(data) {
					console.log(data)
					if(data.status == 0) {
						SetCookie('userId', "");
						alert('退出登录成功')
						window.location.href = "../login.html";
						$('#loginout').html('登录')

					} else {
						alert(data.msg);
					}

				}
			});
		})

		/*清空未读消息*/
		$('#delete_message').click(function() {
			var userId = GetCookie("userId");
			$.ajax({
				type: "get",
				url: "http://47.111.188.27:8080/gsgkzyl/mine/clearlist/"+userId,
				success: function(data) {
					if(data.status == 0) {
						window.location.reload();
					}
				}
			});
		})
		/*未读变为已读*/
		$('.sub_nav li').click(function() {
			$.ajax({
				type: "get",
				url: "http://47.111.188.27:8080/gsgkzyl/mine/markread/29ea3963b35e47ac950275f1861da746",
				success: function(data) {
					if(data.status == 0) {
						$('.no_read img').attr('src', '../../img/note_pre_icon.png')
					}
				}
			});
		})

		$(".sub_nav_01>ul>li").on("click", function(e) {
			console.log(e)
			console.log(e.currentTarget.dataset.idx)
			var idx = e.currentTarget.dataset.idx
			window.location.href = "../discuss_zone/institutions.html?idx=" + idx
		})
	</script>